package com.qingcloud.fexecutor.pojo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

@Getter
@Setter
public class WebPageParam implements Serializable {

    private Integer id;

    @ApiModelProperty("应用Id")
    private Integer appId;

    @ApiModelProperty("分组ID")
    private Integer groupId;

    @ApiModelProperty("页面类型 1-自定义 2-外部链接")
    private Integer pageType;

    @ApiModelProperty("外部链接页面地址")
    private String links;

    @ApiModelProperty("编码")
    private String encoding;

    @ApiModelProperty("图标")
    private String icon;

    @ApiModelProperty("名称")
    private String name;

    @ApiModelProperty("页面功能描述")
    private String comments;

    @ApiModelProperty("数据源ID")
    private Integer dsId;

    @ApiModelProperty("源码ID")
    private Integer sourceId;

    @ApiModelProperty("记录类型（1:分组目录；2：页面; 3:button")
    private Integer pageCategory;

    @ApiModel("查询页面资源参数")
    @Data
    public static class QueryPageResource implements Serializable {

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("关键字")
        private String keyword;

    }

    @ApiModel("页面资源参数")
    @Data
    public static class PageResourceParam implements Serializable {

        @ApiModelProperty("应用id")
        private Integer appId;

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("资源类型 1-API 2-静态资源 3-数据源 4-脚本")
        private Integer resourceType;

        @ApiModelProperty("资源编码数组")
        private List<String> codes;

    }

    @ApiModel("保存页面静态资源参数")
    @Data
    public static class SavePageStaticParam implements Serializable {

        @ApiModelProperty("应用id")
        private Integer appId;

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("访问地址")
        private String url;

        @ApiModelProperty(value = "分组ID")
        private String groupId;

        @ApiModelProperty(value = "使用方式编码")
        private Integer type;

    }

    @ApiModel("使用页面资源参数")
    @Data
    public static class PageResourceUseParam implements Serializable {

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("资源编码")
        private List<String> resourceCodes;

        @ApiModelProperty("使用标志 0-未使用 1-已使用")
        private Integer useFlag;

    }

    @ApiModel("删除页面资源参数")
    @Data
    public static class PageResourceDeleteParam implements Serializable {

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("资源编码")
        private String resourceCode;

    }

    @ApiModel("页面资源响应信息")
    @Data
    public static class PageResourceDTO implements Serializable {

        @ApiModelProperty("应用id")
        private Integer appId;

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("资源类型 1-API 2-静态资源 3-数据源 4-脚本")
        private Integer resourceType;

        @ApiModelProperty("资源编码")
        private String resourceCode;

        @ApiModelProperty(value = "关联的实际资源编码")
        private String realCode;

        @ApiModelProperty("资源名称")
        private String resourceName;

        @ApiModelProperty(value = "资源分类")
        private String groupId;

        @ApiModelProperty("资源名称")
        private String datasourceIcon;

        @ApiModelProperty("API请求方法")
        private String apiMethod;

        @ApiModelProperty("静态资源地址")
        private String staticUrl;
    }

    @ApiModel("更新资源详情参数")
    @Data
    public static class UpdatePageResourceParam implements Serializable {

        @ApiModelProperty("页面ID")
        private Integer pageId;

        @ApiModelProperty("资源编码")
        private String resourceCode;

        @ApiModelProperty("资源名称")
        private String resourceName;

        @ApiModelProperty("触发相关信息对象")
        private String actions;

        @ApiModelProperty("关联的资源编码，多个用,连接")
        private String relateCode;

    }

    @ApiModel("移动页面相关参数")
    @Data
    public static class MovePageParam implements Serializable {

        @ApiModelProperty(value = "页面ID")
        private Integer id;

        @ApiModelProperty(value = "树节点ID")
        private Integer parentId;

        @ApiModelProperty(value = "页面树")
        private List<MovePageParam> children;
    }

    @ApiModel("复制页面资源参数")
    @Data
    public static class CopyPageResourceParam implements Serializable {

        @ApiModelProperty(value = "目标页面ID")
        private Integer destPageId;

        @ApiModelProperty(value = "复制的资源来源")
        private List<CopyPageResourceFrom> fromList;
    }

    @ApiModel("复制页面资源来源参数")
    @Data
    public static class CopyPageResourceFrom implements Serializable {

        @ApiModelProperty(value = "目标页面ID")
        private Integer pageId;

        @ApiModelProperty(value = "资源编码")
        private String resourceCode;
    }

}
